package com.awen.homework;

/**
 * @author : Liu Awen Email:willowawen@gmail.com
 * @create :  2020-05-27
 */
public class Aircraft extends Machine implements Flyable, Roadable, Voyageable {
    public Aircraft() {
        super(100);
    }

    @Override
    public void fly() {
        if (this.getEnergy() >= 25) {
            this.setEnergy(this.getEnergy() - 25);
        } else {
            System.out.println("没能量了,飞不起来");
        }
    }

    @Override
    public void run() {
        if (this.getEnergy() >= 10) {
            this.setEnergy(this.getEnergy() - 10);
        } else {
            System.out.println("没能量了，跑不起来");
        }
    }

    @Override
    public void voyage() {
        if (this.getEnergy() >= 15) {
            this.setEnergy(this.getEnergy() - 15);
        } else {
            System.out.println("没能量了，游不动");
        }
    }
}
